package us.yesor.atlast;

import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

public class AtLast extends ListActivity {
	/*
	 * This class should follow the splash page and should be considered the
	 * root for other activities. For instance, when the app is opened, the
	 * shared preferences are checked to see whether a current collection is
	 * selected. If so, verify with the user that they would like to work with
	 * it. If they say yes, move to the item viewing activity for that
	 * collection. If not, present them with the view collection activity to let
	 * them choose an existing collection or create a new one.
	 */
	private static final String PREFS = "prefs";
	public static final String ID = "us.yesor.ID";
	private String activeCollection;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		SharedPreferences sp = getSharedPreferences(PREFS, Context.MODE_PRIVATE);

		activeCollection = sp.getString("activeCollection", "No Collection Chosen");
		if (!activeCollection.equals("No Collection Chosen")) {
			//TODO Request if would like to see items from that collection
			Intent myIntent = new Intent(this, ViewItemsActivity.class);
			startActivity(myIntent);
		} else {
			Intent myIntent = new Intent(this, ViewCollectionsActivity.class);
			startActivity(myIntent);
		}
	}
}